//
//  HZUserInfoView.m
//  MyDoctor
//
//  Created by 徐彩东 on 16/5/5.
//  Copyright © 2016年 heiyan. All rights reserved.
//

#import "HZUserInfoView.h"


@interface HZUserInfoView ()

///  用户头像
@property (nonatomic , strong ) UIImageView *iconImg;

///  名字img
@property (nonatomic , strong ) UIImageView *nameImg;

///  名字
@property (nonatomic , strong ) UILabel *nameLabel;

///  病例号img
@property (nonatomic , strong ) UIImageView *caseImg;

///  病例号
@property (nonatomic , strong ) UILabel *caseLabel;

///  手机号img
@property (nonatomic , strong ) UIImageView *photoImg;

///  手机号码
@property (nonatomic , strong ) UILabel *photoLabel;


@end

@implementation HZUserInfoView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        //设置界面
        [self setupUI];
        
    }
    return self;
}

#pragma mark - 设置界面
-(void)setupUI{
    
    //设置背景颜色
    self.backgroundColor = [UIColor whiteColor];
    
    //添加子控件
    [self addSubview:self.iconImg];
    [self addSubview:self.nameImg];
    [self addSubview:self.nameLabel];
    [self addSubview:self.caseImg];
    [self addSubview:self.caseLabel];
    [self addSubview:self.photoLabel];
    [self addSubview:self.photoImg];
    
    //约束
    [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.equalTo(30);
        make.bottom.equalTo(self).equalTo(-20);
        make.width.equalTo(self.iconImg.mas_height);
    }];
    
    [self.nameImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).equalTo(20);
        make.left.equalTo(self.iconImg.mas_right).equalTo(20);
        make.height.equalTo(self.caseImg);
        make.width.equalTo(self.nameImg.mas_height);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.nameImg).equalTo(-5);
        make.left.equalTo(self.nameImg.mas_right).equalTo(20);
    }];
    
    [self.caseImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameImg);
        make.top.equalTo(self.nameImg.mas_bottom).offset(8);
        make.height.equalTo(self.photoImg);
        make.width.equalTo(self.caseImg.mas_height);
    }];
    
    [self.caseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.bottom.equalTo(self.caseImg).offset(-5);
    }];
    
    [self.photoImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameImg);
        make.top.equalTo(self.caseImg.mas_bottom).offset(8);
        make.width.equalTo(self.caseImg.mas_height);
        make.bottom.equalTo(self).equalTo(-20);
    }];
    
    [self.photoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel);
        make.bottom.equalTo(self.photoImg).offset(-5);
    }];
    

}

#pragma mark - 懒加载
-(UIImageView *)iconImg{
    
    if (!_iconImg) {
        _iconImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"name"]];
        _iconImg.layer.cornerRadius = _iconImg.bounds.size.width/2;
        _iconImg.layer.masksToBounds = YES;
    }
    return _iconImg;
}

-(UIImageView *)nameImg{
    
    if (!_nameImg) {
        _nameImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"0"]];
    }
    return _nameImg;
}

-(UILabel *)nameLabel{
    
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]initWithTitle:@"哈哈" WitthTextFont:15 WithTextColor:[UIColor blackColor]];
    }
    return _nameLabel;
}

-(UIImageView *)caseImg{
    
    if (!_caseImg) {
        _caseImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"idCard"]];
    }
    return _caseImg;
}

-(UILabel *)caseLabel{
    
    if (!_caseLabel) {
        _caseLabel = [[UILabel alloc]initWithTitle:@"232323432234" WitthTextFont:15 WithTextColor:[UIColor blackColor]];
    }
    return _caseLabel;
}

-(UIImageView *)photoImg{
    
    if (!_photoImg) {
        _photoImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"phone"]];
    }
    return _photoImg;
}

-(UILabel *)photoLabel{
    
    if (!_photoLabel) {
        _photoLabel = [[UILabel alloc]initWithTitle:@"23123123123" WitthTextFont:15 WithTextColor:[UIColor blackColor]];
    }
    return _photoLabel;
}

@end























